# +----------------------------------------------------------------------
# | ChatWork
# +----------------------------------------------------------------------
# | 这不是一个自由软件,您只能在不用于商业目的的前提下对程序代码进行修改和使用。
# | 任何企业和个人不允许对程序代码以任何形式任何目的再发布,商业使用请获取授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from typing import Union
from fastapi import Query
from pydantic import BaseModel, Field


class ChatSessionSearchIn(BaseModel):
    """ 会话搜索参数 """
    bot: str = Query(..., min_length=1, max_length=32, description="智能体编号")
    keyword: Union[int, str, None] = Query(default=None, description="关键词")

    class Config:
        json_schema_extra = {
            "example": {
                "bot": "HCxiS50f0d4nd",
                "keyword": ""
            }
        }


class ChatSessionAddIn(BaseModel):
    """ 会话创建参数 """
    bot: str = Field(..., min_length=1, max_length=32, description="智能体编号")
    name: str = Field(..., min_length=1, max_length=32, description="会话名称")

    class Config:
        json_schema_extra = {
            "example": {
                "bot": "HCxiS50f0d4nd",
                "name": "新的会话"
            }
        }


class ChatSessionEditIn(BaseModel):
    """ 会话编辑参数 """
    id: int = Field(..., gt=0, description="会话ID")
    name: str = Field(..., min_length=1, max_length=32, description="会话名称")

    class Config:
        json_schema_extra = {
            "example": {
                "id": 1,
                "name": "新的会话"
            }
        }


class ChatSessionDeleteIn(BaseModel):
    """ 会话删除参数 """
    id: int = Field(..., gt=0, description="会话ID")

    class Config:
        json_schema_extra = {
            "example": {
                 "id": 1
            }
        }


class ChatSessionClearIn(BaseModel):
    """ 会话清空参数 """
    bot: str = Field(..., min_length=1, max_length=32, description="智能体编号")

    class Config:
        json_schema_extra = {
            "example": {
                "bot": "HCxiS50f0d4nd"
            }
        }


"""--------------- Separator ---------------"""


class ChatSessionListVo(BaseModel):
    """ 会话列表Vo """
    id: int = Field(description="ID")
    name: str = Field(description="会话名称")

    class Config:
        json_schema_extra = {
            "example": {
                "id": 1,
                "name": "新的会话"
            }
        }
